home *** CD-ROM | disk | FTP | other *** search
/ Chip 2007 January, February, March & April / Chip-Cover-CD-2007-02.iso / Pakiet bezpieczenstwa / mini Pentoo LiveCD 2006.1 / mpentoo-2006.1.iso / livecd.squashfs / usr / lib / mozilla-firefox / idl / nsIAccessibleText.idl < prev    next >
Text File  |  2006-05-08  |  6KB  |  145 lines

  1. /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
  2.  *
  3.  * ***** BEGIN LICENSE BLOCK *****
  4.  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
  5.  *
  6.  * The contents of this file are subject to the Mozilla Public License Version
  7.  * 1.1 (the "License"); you may not use this file except in compliance with
  8.  * the License. You may obtain a copy of the License at
  9.  * http://www.mozilla.org/MPL/
  10.  *
  11.  * Software distributed under the License is distributed on an "AS IS" basis,
  12.  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
  13.  * for the specific language governing rights and limitations under the
  14.  * License.
  15.  *
  16.  * The Original Code is the Mozilla browser.
  17.  *
  18.  * The Initial Developer of the Original Code is
  19.  * Netscape Communications Corporation.
  20.  * Portions created by the Initial Developer are Copyright (C) 1999
  21.  * the Initial Developer. All Rights Reserved.
  22.  *
  23.  * Contributor(s):
  24.  *   Paul Sandoz (paul.sandoz@sun.com)
  25.  *   Bill Haneman (bill.haneman@sun.com)
  26.  *   John Gaunt (jgaunt@netscape.com)
  27.  *
  28.  * Alternatively, the contents of this file may be used under the terms of
  29.  * either of the GNU General Public License Version 2 or later (the "GPL"),
  30.  * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
  31.  * in which case the provisions of the GPL or the LGPL are applicable instead
  32.  * of those above. If you wish to allow use of your version of this file only
  33.  * under the terms of either the GPL or the LGPL, and not to allow others to
  34.  * use your version of this file under the terms of the MPL, indicate your
  35.  * decision by deleting the provisions above and replace them with the notice
  36.  * and other provisions required by the GPL or the LGPL. If you do not delete
  37.  * the provisions above, a recipient may use your version of this file under
  38.  * the terms of any one of the MPL, the GPL or the LGPL.
  39.  *
  40.  * ***** END LICENSE BLOCK ***** */
  41.  
  42. #include "nsISupports.idl"
  43.  
  44. typedef long nsAccessibleTextBoundary;
  45. typedef long nsAccessibleCoordType;
  46.  
  47. [scriptable, uuid(E44D3FA6-9CB2-432A-8BDB-69D72B6ADA00)]
  48. interface nsIAccessibleText : nsISupports
  49. {
  50.   const nsAccessibleTextBoundary BOUNDARY_CHAR = 0;
  51.   const nsAccessibleTextBoundary BOUNDARY_WORD_START = 1;
  52.   const nsAccessibleTextBoundary BOUNDARY_WORD_END = 2;
  53.   const nsAccessibleTextBoundary BOUNDARY_SENTENCE_START = 3;
  54.   const nsAccessibleTextBoundary BOUNDARY_SENTENCE_END = 4;
  55.   const nsAccessibleTextBoundary BOUNDARY_LINE_START = 5;
  56.   const nsAccessibleTextBoundary BOUNDARY_LINE_END = 6;
  57.   const nsAccessibleTextBoundary BOUNDARY_ATTRIBUTE_RANGE = 7;
  58.  
  59.   const nsAccessibleCoordType COORD_TYPE_SCREEN = 0;
  60.   const nsAccessibleCoordType COORD_TYPE_WINDOW = 1;
  61.  
  62.   attribute long caretOffset;
  63.  
  64.   readonly attribute long characterCount;
  65.   readonly attribute long selectionCount;
  66.  
  67.     /**
  68.       * String methods may need to return multibyte-encoded strings,
  69.       * since some locales can't be encoded using 16-bit chars.
  70.       * So the methods below might return UTF-16 strings, or they could
  71.       * return "string" values which are UTF-8.
  72.       */
  73.   AString getText (in long startOffset, in long endOffset);
  74.  
  75.   AString getTextAfterOffset (in long offset,
  76.                               in nsAccessibleTextBoundary boundaryType,
  77.                               out long startOffset,
  78.                               out long endOffset);
  79.  
  80.   AString getTextAtOffset (in long offset,
  81.                            in nsAccessibleTextBoundary boundaryType,
  82.                            out long startOffset,
  83.                            out long endOffset);
  84.  
  85.   AString getTextBeforeOffset (in long offset,
  86.                                in nsAccessibleTextBoundary boundaryType,
  87.                                out long startOffset,
  88.                                out long endOffset);
  89.  
  90.     /**
  91.       * It would be better to return an unsigned long here,
  92.       * to allow unicode chars > 16 bits
  93.       */
  94.   wchar getCharacterAtOffset (in long offset);
  95.  
  96.   nsISupports getAttributeRange (in long offset,
  97.                                  out long rangeStartOffset,
  98.                                  out long rangeEndOffset);
  99.  
  100.   void getCharacterExtents (in long offset,
  101.                             out long x,
  102.                             out long y,
  103.                             out long width,
  104.                             out long height,
  105.                             in nsAccessibleCoordType coordType);
  106.  
  107.   long getOffsetAtPoint (in long x, in long y,
  108.                          in nsAccessibleCoordType coordType);
  109.  
  110.   void getSelectionBounds (in long selectionNum,
  111.                            out long startOffset,
  112.                            out long endOffset);
  113.  
  114.   void setSelectionBounds (in long selectionNum,
  115.                               in long startOffset,
  116.                               in long endOffset);
  117.  
  118.   void addSelection (in long startOffset, in long endOffset);
  119.  
  120.   void removeSelection (in long selectionNum);
  121. };
  122.  
  123. /*
  124.  Assumptions:
  125.  
  126.  Using wstring (UCS2) instead of string encoded in UTF-8.
  127.  Multibyte encodings (or at least potentially multi-byte
  128.  encodings) would be preferred for the reasons cited above.
  129.  
  130.  The following methods will throw an exception on failure
  131.  (since not every text component will allow every operation):
  132.  setSelectionBounds, addSelection, removeSelection, setCaretOffset.
  133.  
  134.  getRangeAttributes defined to return an nsISupports
  135.  interface instead of a pango specific data structure.
  136.  It may be that some other return type is more appropriate
  137.  for mozilla text attributes.
  138.  
  139.  we assume that all text components support the idea of
  140.  a caret offset, whether visible or "virtual".  If this
  141.  isn't the case, caretOffset can be made readonly and
  142.  a setCaretOffset method provided which throws an exception
  143.  on failure (as with *selection methods above).
  144. */
  145.